package com.wx.daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.wx.dao.OrderFindDao;
import com.wx.model.Users;
import com.wx.util.DBUtil;

public class OrderFindDaoImpl implements OrderFindDao {

	@Override
	public Users find(String username) throws Exception {
		Connection connection = DBUtil.getConnection();
		PreparedStatement ps = connection.prepareStatement("select * from users where username=?");
		ps.setString(1, username);
		ResultSet rs = ps.executeQuery();
		Users user=new Users();
		if(rs.next()){
			user.setUsername(username);
			user.setHome(rs.getString(7));
			user.setTruename(rs.getString(4));
			user.setPhone(rs.getString(6));
			user.setPostcode(rs.getInt(8));
		}
		return user;
	}

}
